<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include.inc.jsp"%>

<style type="text/css">
.sidebar>.nav>li.active {
	border-top: 1px solid #fcfcfc;
	border-bottom: 1px solid #fcfcfc;
}

.sidebar>.nav>li.active, .sidebar>.nav>li.open, .sidebar>.nav>li.active>a,
	.sidebar>.nav>li.open>a, .sidebar>.nav>li.active>.nav-item, .sidebar>.nav>li.open>.nav-item,
	.sidebar>.nav>li.active .nav, .sidebar>.nav>li.open .nav {
	background-color: #fff;
}
</style>

<input type="hidden" id="url" runat="server" />
<!-- START Sidebar (left)-->
<div class="aside-inner">
	<nav class="sidebar" data-sidebar-anyclick-close="">
		<!-- START sidebar nav-->
		<ul class="nav">
			<c:forEach items="${sysWebMenulist}" var="sysWebMenu" varStatus="oneLevelMenuStatus">

				<li><a href="#I${sysWebMenu.id}" title="${sysWebMenu.name}" data-toggle="collapse"> <c:choose>
							<c:when test="${fn:length

(sysWebMenu.menuIcon) > 0}">
								<em class="icon-user"></em>
							</c:when>
							<c:otherwise>
								<em class="icon-user"></em>
							</c:otherwise>
						</c:choose> <span>${sysWebMenu.name}</span>
				</a>
					<ul id="I${sysWebMenu.id}" class="nav sidebar-subnav collapse">
						<li class="sidebar-subnav-header">${sysWebMenu.name}</li>


						<c:forEach items="${sysWebMenu.listSysWebMenu}" var="sysWebMenuTree" varStatus="twoLevelMenuStatus">
							<li class="${(oneLevelMenuStatus.first && twoLevelMenuStatus.first)?"
								active":""} "
								onclick="maintMenu_OnClick(this,'${ctx}${sysWebMenuTree.linkUrl}',${sysWebMenuTree.showType},this,'${sysWebMenuTree.id}')"><a
								href="#" title="${sysWebMenuTree.name}"> <span>${sysWebMenuTree.name}</span>
							</a></li>
						</c:forEach>

					</ul></li>
			</c:forEach>
		</ul>
		<!-- END sidebar nav-->
	</nav>
</div>
<!-- END Sidebar (left)-->

<script src="${ctx}/static/Angle/app/js/modules/sidebar.js" type="text/javascript"></script>
<script type="text/javascript">

	jQuery(function($) {

		/* $(".submenu").children().children()[0].click();
		var firstmenuname = $.trim($(".submenu").children().children()[0].innerText);
		if (firstmenuname == "在线监控" || firstmenuname == "历史轨迹") {
			$("#sidebar-collapse").click();
		}*/
		resizeMainContent();
		$('.sidebar .active').click();
	});

	function maintMenu_OnClick(obj,url, popups, a, caidanId) {
		
		//切换样式
		changeActive(obj);
		
		if (url.length > 0) {

			if (caidanId) {
				//Url处理，带上菜单信息
				if (url.indexOf('?') == -1) {
					url += "?menukey=" + caidanId;
				} else {
					url += "&menukey=" + caidanId;
				}
			}

			if ((popups == null) || (popups == 0)) {
				window.frames['mainFrame'].location.href = url;
			} else {
				var fh = "&";
				if (url.indexOf('?') == -1) {
					fh = "?";
				}
				window.open(url + fh + "a=" + Math.random());
			}
		}
	}
	
	function changeActive(obj){		
		$(".sidebar .active").removeClass("active");
		$(obj).addClass("active");
		if($(obj).parents("li").html()){
			$(obj).parents("li").addClass("active");
		}else{
			$(".sidebar li.open").addClass("active");
			$("#"+$(obj).parent().attr("id")).collapse('show');
		}
	}
</script>
